<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/ajax.js"></script>
</head>

<body>

</body>

<script>


    $.ajax({
        // type:"get",
        url: "../php/isExistUser.php",
        data: "user=a123123",
        dataType: "json",
        // async:true,
        success: function (data) { // 形式参数=> 请求成功时返回的数据
            console.log("请求成功", data);
        }
    })

    $.ajax({
        type: "get",
        url: "../php/searchAllGrade.php",
        // data:"",
        // async:true,
        dataType: "json",
        success: function (data) {
            console.log("grade请求成功", data);
        }
    })

    // 问题二:
    // 参数数据还是需要自己拼接  => 太麻烦?    (参数数据:键值对形式存在,排名不分先后)
    // 解决方法:  可以传入一个对象作为参数  => 解析该对象  => 参数数据队列
    // {user,pwd,phone,email}  => "user=a123123&pwd=123123&phone=17386141517&email=123123@qq.com"

    $.ajax({
        type: "post",
        url: "../php/login.php",
        data: {
            user: "a123123",
            pwd: 123123,
        },
        // async:true,
        dataType: "json",
        success: function (data) {
            console.log("登录请求成功", data);
        }
    })






</script>

</html>